import { createRouter, createWebHashHistory } from 'vue-router';
import type { RouteRecordRaw } from 'vue-router';
// import { useMenuStore } from '@/stores/user/menu';
let routes: Array<RouteRecordRaw> = [];

// 动态导入路由
const modules: Record<string, any> = import.meta.glob(['./module/*.ts'], {
    eager: true // 开启预加载
});
Object.keys(modules).forEach((key) => {
    const module = modules[key].default;
    routes = [...routes, ...module];
});
const router = createRouter({
    history: createWebHashHistory(),
    routes
});

export default router;
